<template>
    <div class="persona">
        <el-carousel class="imgs" :interval="4000" type="card" height="200px">
            <el-carousel-item class="imgitem" v-for="item in imgs" :key="item.bannerId">
            <img :src="item.pic" alt="">
            </el-carousel-item>
        </el-carousel>
        <div class="resonglist">
            <div class="resonglistname">推荐歌单
            <i class="el-icon-arrow-right"></i>
            </div>
            <div class="resonglistlist">
                <div @click="songlistdata(item.id)" class="imglist"  v-for="(item,index) in resonglist" :key = 'item.id'>
                    <img @mouseover='fnshow(index)' @mouseout='hide' :src="item.picUrl" alt="">
                    <div>{{item.name}}</div>
                    <div @mouseover='fnshow(index)' class="imgiii" :class="{active: index === show}">
                        <i class="el-icon-video-play"></i>
                    </div>
                    <div class="playcount">
                        <i class="el-icon-video-play"></i>
                    {{mill(item.playCount)}}</div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
import http from '@/http/http.js'
import million from '@/unit/numberhalden.js'  //数字过万处理
export default {
    data() {
        return {
            imgs:[],
            resonglist:[],
            show:100
        }
    },
    computed:{
        
    },
    methods: {
        
        mill(value){
             return million(value)
        },

        //点击歌单跳转到歌单详情
        songlistdata(id){
            console.log(id)
            this.$router.push({
                name:'songlistid',
                params:{
                    id
                }
            })
        },

        
        fnshow(index){
            // console.log(index)
            this.show = index
        },
        hide(){
            this.show = 100
        }
    },
    mounted() {
        http({
            url:'/homepage/block/page'
        }).then(res =>{
            // console.log(res.data)
            this.imgs = res.data.data.blocks[0].extInfo.banners
            // this.resonglist = res.data.data.blocks[1].creatives
        })

        http({
            url:'/personalized?limit=10'
        }).then(res =>{
            console.log(res.data.result)
            this.resonglist = res.data.result
            
        })

        
    },
}
</script>

<style lang="less" scoped>


.resonglistname{
    font-size: 22px;
    font-weight: bold;
    margin-bottom:5px ;
}

.persona{
    width: 80%;
    margin: 0 auto;
    min-width:1300px;
    // overflow-y: scroll;
    // white-space: nowrap;
    .resonglist{
        width: 1300px;
        
        .resonglistlist{
            display: flex;
            flex-direction: row;
            flex-wrap: wrap;
            justify-content: space-between;
            .imglist{
                
                width: 250px;
                height: 250px;
                padding-bottom: 50px;
                // border-radius: 10px;
                // overflow: hidden;
                position: relative;
                img{
                    width: 100%;
                    height: 100%;
                    border-radius: 10px;

                    
                }
                .imgiii{
                    display: none;
                    position: absolute;
                    font-size: 40px;
                    color: pink;
                    right: 20px;
                    bottom: 60px;
                }
                .playcount{
                    
                    position: absolute;
                    font-size: 12px;
                    
                    color: white;
                    right: 20px;
                    top: 10px;
                    
                }
                .active{
                    display: block;
                }
            }
        }
        .resonglistlist:hover{
            cursor: pointer;
            
        }
    }
}
.imgs{
    width: 1300px;
    margin-top: 1.25rem;
    .imgitem{
        border-radius: 10px;
        overflow: hidden;
    }
    img{
    width: 100%;
    height: 100%;
    }
}


  
</style>